home *** CD-ROM | disk | FTP | other *** search
/ ...taking it to the Macs! / ...taking it to the Macs!.iso / Extras / ActiveX Mac SDK / ActiveX SDK / Sample Controls / BDiamond / Colors.h < prev    next >
Encoding:
Text File  |  1996-12-20  |  3.0 KB  |  102 lines  |  [TEXT/CWIE]

  1. ///////////////////////////////////////////////////////////////////////////////
  2. //
  3. //    Change History
  4. //
  5. //    961105 MMF    added constants for RGB_GRAY through OLORREF_BROWN.  Seems
  6. //                like these were taken out in the label control, but we'd
  7. //                like to use a common set between the Label and the Ticker,
  8. //                I added them back in.
  9. //
  10.  
  11. #ifndef _Colors_h_
  12. #define _Colors_h_
  13.  
  14. ///////////////////////////////////////////////////////////////////////////////
  15. //
  16. //  Initialize colors
  17. //
  18. extern const RGBColor RGB_WHITE;
  19. extern const RGBColor RGB_BLACK;
  20. extern const RGBColor RGB_YELLOW;
  21. extern const RGBColor RGB_MAGENTA;
  22. extern const RGBColor RGB_RED;
  23. extern const RGBColor RGB_CYAN;
  24. extern const RGBColor RGB_GREEN;
  25. extern const RGBColor RGB_BLUE;
  26.  
  27. extern const RGBColor RGB_GRAY;
  28. extern const RGBColor RGB_LTGRAY;
  29. extern const RGBColor RGB_BROWN;
  30.  
  31. extern const RGBColor COLORREF_RED;
  32. extern const RGBColor COLORREF_GREEN;
  33. extern const RGBColor COLORREF_BLUE;
  34. extern const RGBColor COLORREF_MAGENTA;
  35. extern const RGBColor COLORREF_CYAN;
  36. extern const RGBColor COLORREF_BLACK;
  37. extern const RGBColor COLORREF_YELLOW;
  38. extern const RGBColor COLORREF_WHITE;
  39.  
  40. extern const RGBColor COLORREF_LTRED;
  41. extern const RGBColor COLORREF_LTGREEN;
  42. extern const RGBColor COLORREF_LTBLUE;
  43. extern const RGBColor COLORREF_LTMAGENTA;
  44. extern const RGBColor COLORREF_LTCYAN;
  45.  
  46. extern const RGBColor COLORREF_GRAY;
  47. extern const RGBColor COLORREF_LTGRAY;
  48. extern const RGBColor COLORREF_BROWN;
  49.  
  50. ///////////////////////////////////////////////////////////////////////////////
  51. //
  52. //  Structures
  53. //
  54. typedef struct tagCOLORREF
  55. {
  56.     unsigned char red;
  57.     unsigned char green;
  58.     unsigned char blue;    
  59. } COLORREF;
  60.  
  61. ///////////////////////////////////////////////////////////////////////////////
  62. //
  63. //  macros
  64. //
  65. #define MAX_UBYTE  0xFF
  66. #define MAX_USHORT 0xFFFF
  67. #define CONVERSION (MAX_USHORT / MAX_UBYTE)
  68.         
  69. #define ABSVAL(x) ((x)>0?(x):(-(x)))
  70.  
  71. #define COLOR_EQ(x,y) (((x).red==(y).red) && ((x).green==(y).green) && ((x).blue==(y).blue))
  72. #define SET_COLOR(x,y) { (x).red = (y)->red; (x).green = (y)->green; (x).blue = (y)->blue; }
  73.  
  74. #define RGBDELTA(x,y)  ( ( ABSVAL((x)->red - (y)->red) + \
  75.                           ABSVAL((x)->green - (y)->green) + \
  76.                           ABSVAL((x)->blue - (y)->blue) ) / 3 )
  77.  
  78. #define MIN3(x,y,z) (((x)<(y)?(x):(y))<(z)?((x)<(y)?(x):(y)):(z))
  79.  
  80.  
  81.  
  82. ///////////////////////////////////////////////////////////////////////////////
  83. //
  84. //  Function Prototypes
  85. //
  86.  
  87. void MapColorRefToRGBColor(const COLORREF * desiredColorRef, RGBColor * desiredRGBColor, Boolean useColorMatching = true);
  88.                 
  89. void MatchColor (
  90.     const RGBColor * targetColor, 
  91.     const RGBColor ** colorPtrArray, 
  92.     short arraySize, 
  93.     unsigned long & delta, 
  94.     short & index);
  95.     
  96. Boolean RGBColorsEQ( const RGBColor & color1, const RGBColor & color2 );
  97. RGBColor RGBColorsPERCENT(const RGBColor color, const double percent);
  98. RGBColor RGBColorsPLUS(const RGBColor color1, const RGBColor color2);
  99. RGBColor RGBColorsInterpolate(const RGBColor color1, const RGBColor color2, double percent);
  100.  
  101.     
  102. #endif // _Colors_h_